home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre4.z / postgre4 / src / utils / cache / rel.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  1.6 KB  |  67 lines

  1. /*
  2.  * rel.c --
  3.  *    POSTGRES relation descriptor code.
  4.  */
  5.  
  6. /* #define RELREFDEBUG    1 */
  7.  
  8. #include "tmp/postgres.h"
  9. #include "tmp/miscadmin.h"
  10.  
  11. RcsId("$Header: /private/postgres/src/utils/cache/RCS/rel.c,v 1.4 1992/03/02 21:17:34 mer Exp $");
  12.  
  13. #include "access/istrat.h"
  14. #include "access/tupdesc.h"
  15.  
  16. #include "utils/rel.h"
  17. #include "storage/fd.h"
  18.  
  19. /* 
  20.  *    RelationIsValid is now a macro in rel.h -cim 4/27/91
  21.  *
  22.  *      Many of the RelationGet...() functions are now macros in rel.h
  23.  *        -mer 3/2/92
  24.  */
  25.  
  26. /* ----------------
  27.  *    RelationGetIndexStrategy
  28.  * ----------------
  29.  */
  30. IndexStrategy
  31. RelationGetIndexStrategy(relation)
  32.     Relation    relation;
  33. {
  34.     return (IndexStrategy)
  35.     relation->rd_att.data[ relation->rd_rel->relnatts];
  36. }
  37.  
  38. /* ----------------
  39.  *    RelationSetIndexSupport
  40.  *
  41.  *    This routine saves two pointers -- one to the IndexStrategy, and
  42.  *    one to the RegProcs that support the indexed access method.  These
  43.  *    pointers are stored in the space following the attribute data in the
  44.  *    reldesc.
  45.  * ----------------
  46.  */
  47. void
  48. RelationSetIndexSupport(relation, strategy, support)
  49.     Relation    relation;
  50.     IndexStrategy    strategy;
  51.     RegProcedure    *support;
  52. {
  53.     IndexStrategy    *relationIndexStrategyP;
  54.  
  55.     Assert(PointerIsValid(relation));
  56.     Assert(IndexStrategyIsValid(strategy));
  57.  
  58.     relationIndexStrategyP = (IndexStrategy *)
  59.     &relation->rd_att.data[relation->rd_rel->relnatts];
  60.  
  61.     *relationIndexStrategyP = strategy;
  62.     relationIndexStrategyP = (IndexStrategy *)
  63.     (((char *) relationIndexStrategyP) + sizeof(relationIndexStrategyP));
  64.     *relationIndexStrategyP = (IndexStrategy) support;
  65. }
  66.  
  67.